﻿@model StoryTellerSite.Models.PagerModel
@if (Model.TotalPages > 1)
{
 
    <div class="divPaginacao">
        <ul class="pagination">
            @{
    int inicial = (Model.Current * Model.ItemsPerPage) - Model.ItemsPerPage;
    int final = 0;
    if (Model.TotalPages == Model.Current)
    {
        final = Model.Current * Model.ItemsPerPage - (Model.Current * Model.ItemsPerPage - Model.TotalItems);
    }
    else
    {
        final = Model.Current * Model.ItemsPerPage;
    }
    
            }
            @* <span class="mostrarPaginas">Mostrando @(inicial + 1)
                - @final de @Model.TotalItems
                resultados</span>*@
            @if (Model.Current != 1)
            {   
                <li Controller="@Model.Controller" Index="1"><a href="javascript:void(0);">First</a></li>
                <li Controller="@Model.Controller" Index="@(Model.Current - 1)"><a href="javascript:void(0);">
                    <</a></li>
                
            }
            @for (int i = Model.StatAt; i < Model.EndAt; i++)
            {
                if (i != Model.Current)
                {
                <li Controller="@Model.Controller" Index="@i"><a href="javascript:void(0);">@i</a></li>                
                }
                else
                {
                <li class="active"><a href="javascript:void(0);">@i</a></li>
                }
            }
            @if (Model.Current != Model.TotalPages)
            {    
                @*<li Controller="@Model.Controller" Index="@(Model.Current + 1)"><a href="javascript:void(0);">
                    ></a></li>*@     
                <li Controller="@Model.Controller" Index="@Model.TotalPages"><a href="javascript:void(0);">
                    Last</a></li>                     
            }
        </ul>
    </div>


    
}